from selenium.webdriver.common.by import By
from yvekao.Base import Base
import time


class Page2(Base):
    name_log = (By.XPATH, "/html/body/div[1]/div/section/section/main/form/div[1]/div/div[1]/div/input")

    def tian_name(self, test):
        self.send_keys(self.name_log, test)

    type_log = (By.XPATH, "/html/body/div[1]/div/section/section/main/form/div[2]/div/div[1]/textarea")

    def tian_type(self, test):
        self.send_keys(self.name_log, test)

    zhuang_log = (By.XPATH, "/html/body/div[1]/div/section/section/main/form/div[3]/div/div[1]/textarea")

    def tian_zhuang(self, test):
        self.send_keys(self.name_log, test)

    jiao_log = (By.XPATH, '/html/body/div[1]/div/section/section/main/form/div[4]/div/button[1]')

    def tian_jiao(self):
        self.click(self.jiao_log)

    def tian_go(self, name, type, zhuang):
        self.open_url("http://localhost:8080/additemnew")
        time.sleep(2)
        self.tian_name(name)
        time.sleep(2)
        self.tian_type(type)
        self.tian_zhuang(zhuang)
        time.sleep(2)
        self.tian_jiao()
        time.sleep(2)
